import request from '../request'

// 商品管理 - 列表
function list(data) {
    return request.get('/commerce_commodity/commerceCommodity/api/list', data)
}
// 商品管理 - 类型列表
function typeList(data) {
    return request.get('/commerce_commodity_type/commerceCommodityType/api/list', data)
}

// 下单
function placeOrder(data) {
    return request.post('/commerce_order/commerceOrder/api/placeOrder', data)
}

// 订单列表
function orderList(data) {
    return request.get('/commerce_order/commerceOrder/api/list', data)
}

// 订单详情
function orderDetail(data) {
    return request.get('/commerce_order/commerceOrder/api/detail', data)
}

// 地址列表
function addressList(data) {
    return request.get('/commerce_address/commerceAddress/api/list', data)
}

// 编辑地址
function setupAddress(data) {
    return request.put(`/commerce_address/commerceAddress/api/${data.id}`, data)
}

// 地址详情
function addressDetail(data) {
    return request.get(`/commerce_address/commerceAddress/api/detail`, data)
}

// 新增地址
function addAddress(data) {
    return request.post('/commerce_address/commerceAddress/api', data)
}

// 更新地址
function updateAddress(data) {
    return request.put(`/commerce_address/commerceAddress/api/${data.id}`, data)
}
// 取消订单
function cancelOrder(data) {
    return request.put(`/commerce_order/commerceOrder/api/cancel/${data.id}`, data)
}
// 删除订单
function delOrder(data) {
    return request.del('/commerce_order/commerceOrder/api', data)
}


export default {
    list,
    typeList,
    placeOrder,
    orderList,
    orderDetail,
    addressList,
    setupAddress,
    addressDetail,
    addAddress,
    updateAddress,
    cancelOrder,
    delOrder
}